/**
 * 
 */
package cre.gutwo.swing;

import javax.swing.JTextArea;

/**
 * @author Cre.Gu
 *
 */
public class JPrintStream {

	private JTextArea textArea;
	private OutputDialog outputDialog;
	@SuppressWarnings("unused")
	private HandleFrame handleFrame;

	public JPrintStream(HandleFrame handleFrame) {
		this.handleFrame = handleFrame;
	}

	public void begin() {
		outputDialog = new OutputDialog();
		outputDialog.setTitle("转换进度");
		outputDialog.setLocationRelativeTo(null);

		outputDialog.setSize(500, 280);
		outputDialog.setResizable(false);

		outputDialog.setVisible(true);
		outputDialog.setAlwaysOnTop(true);

		textArea = outputDialog.getTextArea();
	}

	public void println(final String message) {
		textArea.append(message + "\n");
		textArea.setCaretPosition(textArea.getText().length());

	}

	public void alert() {
		if (outputDialog != null) {
			//outputDialog.alert();
		}
	}

}
